﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using PicSolve;

namespace PicTests
{
    [TestClass]
    public class PLineTest
    {
        [TestMethod]
        public void InstancierPLineTest()
        {
            PLine p = new PLine(10);
            Assert.IsNotNull(p);

            p = new PLine(10, PValue.Box);
            Assert.IsNotNull(p);

            p = new PLine("00000");
            Assert.IsNotNull(p);
        }

        [TestMethod]
        public void InstancierEcrirePLineTest()
        {
            PLine p = new PLine("0101010101-");
            string s = p.ToString();
            Assert.AreEqual(s, "0101010101-");
        }

        [TestMethod]
        public void Modifier3EtatsPLineTest()
        {
            PLine p = new PLine("0101010101");

            for (int i = 0; i < p.Length; i++)
            {
                p[i] = PValue.Unknown;
            }

            Assert.IsTrue(p.ToString().Equals("----------"));

            for (int i = 0; i < p.Length; i++)
            {
                p[i] = PValue.NoBox;
            }

            Assert.IsTrue(p.ToString().Equals("0000000000"));

            for (int i = 0; i < p.Length; i++)
            {
                p[i] = PValue.Box;
            }

            Assert.IsTrue(p.ToString().Equals("1111111111"));
        }
    }
}
